import { dbConfig, serviceConfig } from "../etc/config";
import lyu from "../framework/lyu";
import gRedis from "../storage/gRedis";
import loginWeb from "./login";

async function main() {
    let config = {
        name: "Login",
        redis: dbConfig.redis,
    }
    if (await lyu.start(config) == null) {
        console.error("服务启动失败")
        return;
    }

    lyu.startWeb(serviceConfig.HttpPort);
    await lyu.startMongo(dbConfig.mongo);
    await lyu.startMongo(dbConfig.mongo);
    await lyu.startRedis(dbConfig.redis);

    lyu.startNet(8811);

    lyu.netOn(123, (agent, data) => {
        console.log("test 123", data);
        agent.send(123, {
            msg: "你好, 我是服务器",
        });
    })
    await gRedis.init();

    await loginWeb.start();

    console.log("登录服启动完毕");
}

main();